class ConversationManager:
    def __init__(self):
        self.sessions = {}

    def get_session(self, conversation_id):
        if conversation_id not in self.sessions:
            self.sessions[conversation_id] = []
        return self.sessions[conversation_id]

    def add_message(self, conversation_id, message):
        session = self.get_session(conversation_id)
        session.append(message)

    def get_history(self, conversation_id):
        return self.get_session(conversation_id)

    def get_turns(self, conversation_id):
        # 每一轮包含用户和系统的各一次对话
        return len(self.get_session(conversation_id)) // 2